#include <cstdio>
#include <queue>

const int N = 1005, mod = 1e7 + 7;
int n, m, ans, c[N], f[N][N];

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("gift.in", "r", stdin);
  freopen("gift.out", "w", stdout);
#endif
#endif

  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &c[i]);
  /*
  for (int i = 1; i <= n; ++i) {
    for (int j = c[i]; j <= m; ++j) {
      // f[i][j] += f[i - 1][j];
      // f[i][j] %= mod;
      f[i][j] = (f[i - 1][j - c[i]] + f[i - 1][j]) % mod + 1, f[i][j] %= mod;
      // f[i + 1][j + c[i + 1]] += f[i][j], f[i + 1][j + c[i + 1]] %= mod;
      // if (!j) f[i + 1][j] += f[i][j], f[i + 1][j] %= mod;
    }
  }
  int ans = 0;
  for (int j = 1; j <= m; ++j) ans += f[n][j], ans %= mod; */
  for (int i = 0, tmp; i < 1 << n; ++i) {
    tmp = m;
    std::priority_queue<int, std::vector<int>, std::greater<int> > pq;
    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        tmp -= c[j + 1];
      } else
        pq.push(c[j + 1]);
    }
    if (tmp < 0 || (!pq.empty() && tmp > pq.top())) continue;
    ++ans;
  }
  printf("%d", ans);
  return 0;
}